package com.wj.graph;

/**
 * 有向边
 * @author wen.jie
 * @date 2021/8/30 14:39
 */
public class DirectedEdge {

    private final int v;

    private final int w;

    private final double weight;

    public DirectedEdge(int v, int w, double weight) {
        this.v = v;
        this.w = w;
        this.weight = weight;
    }

    public double weight() {
        return this.weight;
    }

    //起点
    public int from() {
        return v;
    }

    //终点
    public int to() {
        return w;
    }

    @Override
    public String toString() {
        return "DirectedEdge{" +
                "v=" + v +
                ", w=" + w +
                ", weight=" + weight +
                '}';
    }
}
